1. Field of the Invention
The present invention relates to disk drives. More particularly, the present invention relates to a disk drive using a rotational position optimization (RPO) algorithm to facilitate write abort operations.
2. Description of the Prior Art
FIG. 1A shows a prior art disk drive 2 comprising a disk 4 for recording a plurality of concentric tracks 6. Each track 6 is partitioned into a number of data sectors for storing user data. A head 8 is connected to a distal end of an actuator arm 10 which is rotated about a pivot in order to actuate the head 8 radially over the disk 4. The disk 4 further comprises a plurality of embedded servo sectors 12 processed to maintain the head 4 over the centerline of a target track during read and write operations.
A disk controller 14 controls the operation of the disk drive 2 by executing read and write commands received from a host computer. The commands received from the host are inserted into an input/output (I/O) queue and executed according to a rotational position optimization (RPO) algorithm. The RPO algorithm is used by the disk controller 14 to select commands from the I/O queue in an order that will optimize performance with respect to the mechanical latencies of the disk drive, including the seek latency of the head 8 and the rotational latency of the disk 4.
FIG. 1B shows a flow diagram of the steps executed by the disk controller 14 while executing a write operation. At step 16, a write command is selected from the I/O queue according to the RPO algorithm (as determined from the current radial and circumferential location of the head 8 and other commands in the I/O queue). At step 18, the disk controller 14 seeks the head 8 to a target track comprising target data sectors to be written, and then waits for the disk 4 to rotate until the head 8 is positioned over the first target data sector. Ideally the head will reach the target track at the end of a seek immediately preceding the first target data sector in order to minimize the rotational latency while waiting for the first target data sector to reach the head 8.
At step 20 the disk controller 14 writes the user data to the target data sectors, however, during this step various conditions may cause the disk controller 14 to abort the write operation. For example, if the embedded servo sectors 12 indicate that the head 6 has deviated from the centerline of the target track (beyond a threshold), then the write is aborted. The disk drive may also employ a shock detector for detecting physical shocks to the disk drive. If the shock detector indicates the disk drive has been subjected to a substantial shock exceeding a threshold, the write may be aborted. The write may also be aborted if an abnormal fly-height is detected for the head 8, or if the head 8 strikes an asperity on the disk 4 causing an abnormal thermal response (thermal asperity).
If the prior art disk drive of FIG. 1A aborts the write operation at step 22, then at step 24 the disk controller 14 waits for the disk 4 to rotate until the head 8 again reaches the first target data sector. The disk controller 14 will then rewrite the user data to the target track at step 20. This procedure is iterated until the user data is successfully written to the target track without aborting the write operation at step 22. However, waiting for the head 8 to reach the first target data sector after an aborted write operation degrades performance due to the undesirable rotational latency of the disk 4. This is illustrated in FIG. 1A wherein as the disk 4 rotates in a counter clockwise direction, the write operation begins at the START location and aborts the operation before reaching the STOP location. The disk controller 14 then waits at step 24 for the disk to rotate until the head 8 again reaches the START location. On average, the rotational latency will equal one-half a rotation of the disk 4.
There is, therefore, a need for a disk drive which aborts write operations more efficiently so as to improve performance with respect to the rotational latency of the disk.
The present invention may be regarded as a disk drive comprising a disk having a plurality of concentric tracks, each track comprising a plurality of data sectors, and a head actuated radially over the disk. The disk drive further comprises an input/output queue for storing read and write commands received from a host computer, and a disk controller for executing the commands stored in the input/output queue in an order determined from a rotational positioning optimization (RPO) algorithm. The disk controller selects a first write command from the input/output queue according to the RPO algorithm, the first write command for writing user data to a plurality of target data sectors including a first target data sector and a last target data sector. The disk controller seeks the head to a target track comprising the target data sectors, waits for the disk to rotate until the head reaches the first target data sector, and begins writing user data to at least the first target data sector. If an abnormal condition is detected, the first write command is aborted before reaching the last target data sector and a second command is selected from the input/output queue according to the RPO algorithm. If the second command is the first write command, the second command is executed to write user data to at least one of the plurality of target data sectors.
In one embodiment, the second command is executed by writing user data to each of the plurality of target data sectors. In an alternative embodiment, the disk controller modifies the first write command so that when the second command is executed user data is written to a plurality of the target data sectors that follow the data sector where the first write command was aborted.
In one embodiment, the disk drive further comprises a semiconductor memory for caching the user data corresponding to the first write command, wherein the disk controller de-allocates the memory storing at least part of the user data after executing the second command. In one embodiment if the amount of free memory decreases to a predetermined limit, the disk controller expedites execution of the second command.
In one embodiment, the abnormal condition is detected if the head deviates beyond a threshold from a centerline of the target track while executing the first write command. In one embodiment, the head generates a read signal and the abnormal condition is detected if the read signal exceeds a threshold for a predetermined interval. In one embodiment, the abnormal condition is detected if the head is flying at an abnormal height, and in one embodiment, the abnormal condition is detected if the head strikes an asperity on the disk. The present invention may also be regarded as a method of aborting a write operation in a disk drive, the disk drive comprising a disk having a plurality of concentric tracks including a plurality of data sectors, a head actuated radially over the disk, and an input/output queue for storing read and write commands received from a host computer. A first write command is selected from the input/output queue according to a rotational position optimization (RPO) algorithm, the first write command for writing user data to a plurality of target data sectors including a first target data sector and a last target data sector. The head is positioned over the target track comprising the target data sectors, and when the disk rotates so that the first target data sector reaches the head, user data is written to at least the first target data sector. If an abnormal condition is detected, the first write command is aborted before reaching the last target data sector, and a second command is selected from the input/output queue according to the RPO algorithm. If the second command is the first write command, the second command is executed to write user data to at least one of the target data sectors.